﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
	
	public $images;
	public $name;
	public $addtime;
	public $content;
	public $talkid;
	public $userid;
	public $touserid;
	public $toname;
	public $replyid;
	public $allimages;
	public $thumbImages;
	function __construct($images,$name,$addtime,$content,$talkid,$userid,$touserid,$toname,$replyid,$allimages,$thumbImages)
	{
		
		$this->images      = $images;
		$this->name      = $name;
		$this->addtime      = $addtime;
		$this->content      = $content;
		$this->talkid      = $talkid;
		$this->userid      = $userid;
		$this->touserid     = $touserid;
		$this->toname      = $toname;
		$this->replyid      = $replyid;
		$this->allimages      = $allimages;
		$this->thumbImages      = $thumbImages;
	}
}

if($_REQUEST['page']!="")
{
$de=$_REQUEST['page']*$_REQUEST['pagesize'];
$size=$_REQUEST['pagesize'];
}

else
{
$de=0;
$size=5;
}




   $rert31=mysql_query("select *from reply where talkid='".$_REQUEST['tid']."'  order by id desc limit $de,$size ");
  $prize = array();
 while($rowf=mysql_fetch_array($rert31)){

  
     $rert32=mysql_query("select *from user where userid='".$rowf[userid]."'");
     $rowf3=mysql_fetch_array($rert32);
	 
	 $rert34=mysql_query("select *from user where userid='".$rowf[touserid]."'");
     $rowf4=mysql_fetch_array($rert34);


   $de=array();//图片
		if($rowf[images]!=""){
			$ime=$rowf[images];
			$de=explode("," ,$ime);
		}
	 //图片end
   	$thumbImages=array();//缩略图
		if($rowf[thumbImages]!=""){
			$thumbImages=explode("," ,$rowf[thumbImages]);
		}
	 //缩略图end   
	$prize[] = new MyPrizeBean($rowf3['images'],$rowf3['niname'],$rowf['addtime'],$rowf['content'],$rowf['id'],$rowf[userid],$rowf[touserid],$rowf4['niname'],$rowf['id'],$de,$thumbImages);
		

}
echo json_encode($prize);


?>